/**
 * 图片预览方法
 */
const previewImage = (urls, current, urlName = '') => {
    let list = []
    if (urlName) {
        list = urls.map(item => item[urlName])
    } else {
        list = urls
    }
    uni.previewImage({
        urls: list,
        current,
        success: function (res) {
            console.log(res);
        },
    });
}

function first(arr) {
    if (arr && arr[0]) {
        return arr[0].path
    }
}

function list(arr) {
    if (arr) {
        return arr.map(item => item.path)
    }
    return []
}

export default {
    previewImage, first, list
}
